<?php
	$cart = $this->cart;
	if ($cart->get_items()) {
		echo '<table><tr><th>Quantity</th><th> </th><th>Name</th><th>Unit Price</th><th>Total Price</th><th> </th></tr>';

		foreach($cart->get_items() as $item) {
			$product = $item->product;
			echo '<tr>',
					'<td>',
						link_to('Add', array('action' => 'addToCart', 'id' => $product->id)),'<br />',
						$item->quantity,'<br />',
						link_to('Remove', array('action' => 'removeFromCart', 'id' => $product->id)),
					'</td>',
					'<td>',
						isset($product->productimages[0]->name) ? link_to(image_tag("pico_full/{$product->productimages[0]->name}"), array('action' => 'viewProduct', 'id' => $product->id)) : 'No image available',
					'</td>',
					'<td>',
						link_to($product->name, array('action' => 'viewProduct', 'id' => $product->id)),
						'<br />Material: ', $product->material,
						'<br />Description: ',$product->description,
						'<br />Specification: ',$product->specification,
						'<br />Dimensions: ',$product->get_dimensions(),
					'</td>',
					'<td>',
						$item->price,
					'</td>',
					'<td>',
						($item->price * $item->quantity),
					'</td>',
				'</tr>';
			echo '<tr><td></td><td></td><td>',
						($item->mounting_price > -1) ? link_to('Remove Mounting', array('action' => 'removeMountingCart', 'id' => $product->id)) : link_to('Add Mounting - '. $product->mounting_price, array('action' => 'addMountingCart', 'id' => $product->id)),
					'</td><td>',
						($item->mounting_price > -1) ? $item->mounting_price : '',
					'</td><td>',
						($item->mounting_price > -1) ? ($item->mounting_price * $item->quantity) : '',
					'</td></tr>';
		}
		echo '<tr><td></td><td></td><td></td><td>Sub Total</td><td>',$cart->get_sub_total(),'</td></tr>';
		echo '<tr><td></td><td></td><td></td><td>Transport</td><td>',($cart->get_transport() > -1) ? $cart->get_transport() : 'Transport not included','</td><td>', ($cart->get_transport() > -1) ? link_to('Remove', array('action' => 'removeTransport')) : '' ,'</td></tr>';
		if ($cart->get_discount() > -1) { echo '<tr><td></td><td></td><td></td><td>Discount</td><td>', $cart->get_discount(),'</td><td>', link_to('Remove', array('action' => 'removeDiscount')),'</td></tr>';}
		echo '<tr><td></td><td></td><td></td><td>Grand Total</td><td>',$cart->get_grand_total(),'</td><td></td></tr>';
		echo '</table>';
		start_form_tag('updateDiscountAndTransport/');
		label_tag('transport-price', 'Transport');

		text_field_tag('transport_price', ($cart->get_transport() > -1) ? $cart->get_transport() : '');
		echo '<br />';
		label_tag('discount', 'Discount');
		text_field_tag('discount', ($cart->get_discount() > -1) ? $cart->get_discount() : '');
		submit_tag('update');
		end_form_tag();
	}
	else { echo '<h4>Your Cart is empty</h4>'; }
echo link_to('Empty Cart', array('action' => 'emptyCart')); 
echo '<br />';
echo link_to('Save Performa Invoice', array('action' => 'savePerformaInvoice'));

?>